<?php session_start() ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php session_start();
include_once("http://02d2e0a.netsolhost.com/includes/timeout.php");?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Kalamazoo Animal Rescue</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?php include("http://02d2e0a.netsolhost.com/includes/head.inc");  ?>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<!--initial body width and height set up  -->
<div id="bodywidth">
<?php include("http://02d2e0a.netsolhost.com/includes/header.inc");  ?>
<?php include("http://02d2e0a.netsolhost.com/includes/leftmenu.inc");  ?>
<!-- place center column content below -->
<div id="centercontent" style="width: 475px; height: auto">
    <HR class="thickline"/>
    <h2 class="style9">Upcoming Events</h2>
<?php
include("./includes/db.php");
				// Connect to the database server
dbConnect('kar_web1');   	// Use function in db.php to connect
$result = @mysql_query("SELECT *
						FROM events 
						WHERE eventDate >= current_date AND eventDate < ADDDATE( current_date, 7 )
						ORDER BY eventDate") or
			die("Error getting events. ".mysql_error());
echo("<TABLE cellpadding=0 cellspacing=0>");
$num_rows = mysql_num_rows($result);
while ( $row = mysql_fetch_array($result) ) {
	$eventLoc = $row["location_id"];
	$ID = $row["eventID"];

	$BTime =  $row["eventBeginTime"];
	list($Bhour, $Bmin, $Bsec) = explode(":", $BTime);
	$BeginTime = date("ga", mktime($Bhour, $Bmin));
	
    $ETime =  $row["eventEndTime"];
	list($Ehour, $Emin, $Esec) = explode(":", $ETime);
	$EndTime = date("ga", mktime($Ehour, $Emin));
	
    $event = $row["eventID"];
	list($year, $month, $day)  = explode("-", $row["eventDate"]);
    $eventDate = date("F jS", mktime(0,0,0,$month, $day,$year));
    
    $query = "SELECT * FROM locations WHERE location_id = ".$eventLoc;
    $locationInfo = mysql_fetch_array(@mysql_query($query));
    $URL = $locationInfo["map"];
    $eventName = $locationInfo["name"];
    $friendlyLoc = $locationInfo["friendly_address"];
    
	echo("<TR><TD><h4>");
	if ($friendlyLoc != "")
    	echo($eventName." on ".$friendlyLoc." <a href=".$URL.">Map</a></h4></TD></TR>" );
    else
    	echo($eventName." <a href=".$URL.">Map</a></h4></TD></TR>" );

    echo("<TR><TD><h4>".$eventDate." (". $BeginTime . "-" . $EndTime.") <a href=\"#\">See the scheduled pets</a></h4></TD></TR><TR><TD>&nbsp;</TD></TR>");
}
echo("</TABLE>");
?>
    <h4>For more events click <a href="#">here</a></h4>
    <p align="center">&nbsp;</p>
    <hr class="thickline"/>
</div>
<!-- place right column content below -->

<div id="rightcolumn">

<div class="blue_background">

<h1 align="center">Pets of the Month<br />

<?php

	$dogQuery = @mysql_query("SELECT *
							FROM dogs
							WHERE pom = '1'") or

				die("Error getting events. ".mysql_error());

	$dogInfo = mysql_fetch_array($dogQuery);

	$catQuery = @mysql_query("SELECT *
							FROM cats
							WHERE pom = '1'") or

				die("Error getting events. ".mysql_error());

	$catInfo = mysql_fetch_array($catQuery);

	echo("<a href=\"http://02d2e0a.netsolhost.com/pets2.php?displaypet=".$row['tagNum']."\">".$dogInfo['pet_name']."</a><br />");

	echo("<a href=\"http://02d2e0a.netsolhost.com/pets2.php?displaypet=".$row['tagNum']."\"><img src=\"http://02d2e0a.netsolhost.com/images/dogs/".$row['tagNum']."-1-main.jpg\" width=\"180\" border=\"0\" /></a><br />");

	echo('<br />');

	echo("<a href=\"http://02d2e0a.netsolhost.com/pets2.php?displaypet=".$row['tagNum']."\">".$catInfo['pet_name']."</a><br />");

	echo("<a href=\"http://02d2e0a.netsolhost.com/pets2.php?displaypet=".$row['tagNum']."\"><img src=\"http://02d2e0a.netsolhost.com/images/cats/".$row['tagNum']."-1-main.jpg\" width=\"180\" border=\"0\" /></a><br />");

$result1 = @mysql_query("SELECT * 
					FROM cats
					WHERE
					pet_status = 'a' and 
					adopted_date >= '2009-01-01'") or

		die("Error getting events. ".mysql_error());

$result2 = @mysql_query("SELECT * 
					FROM dogs
					WHERE
					pet_status = 'a' and 
					adopted_date >= '2009-01-01'") or

		die("Error getting events. ".mysql_error());

$num_rows1 = mysql_num_rows($result1);
$num_rows2 = mysql_num_rows($result2);

echo("<br />

KAR has placed</h1>
<p align='center' class='style9'>".$num_rows2." Dogs and</p>
<p align='center' class='style9'>".$num_rows1." Cats into</p>
<p align='center' class='style9'>Permanent Homes</p>
<p align='center' class='style9'>so far in 2009</p>
");

?>

    <h1 align="center" class="style9">&nbsp;</h1>
    <h1 align="center" class="style9">KAR Placed</h1>
    <p align="center" class="style9">274 Dogs and</p>
    <p align="center" class="style9">444 Cats into </p>
    <p align="center" class="style9">Permanent Homes </p>
    <p align="center" class="style9">in 2008</p>
    <p align="center" class="style9">&nbsp;</p>

    <p align="left">&nbsp;</p>
    <p style="text-align: center"><br />

 </p>

	</div>

<!--end blue background div-->

</div>

<? include("http://02d2e0a.netsolhost.com/includes/footer.inc");  ?>
<!--tag below ends bodywidth div -->


</div>
</body>
</html>